package presenter;


import java.util.Observer;

import bean.SystemMessgeBean;
import interfaces.ISystemMeesgeface;
import util.volley.ICompleteListener;
import util.volley.ResultEntity;

/**
 * Created by itboye on 2016/12/3.
 */

public class SysTemMessgelPresenter extends BasePresenter implements
        ISystemMeesgeface<SystemMessgeBean> {

    /**
     * 道路救援
     */
    public static final String SystemMessge_success = SysTemMessgelPresenter.class.getName()
            + "_SystemMessge_success";
    public static final String SystemMessge_fail = SysTemMessgelPresenter.class.getName()
            + "_SystemMessge_fail";


    public static final String Driver_success = SysTemMessgelPresenter.class.getName()
            + "_Driver_success";
    public static final String Driver_fail = SysTemMessgelPresenter.class.getName()
            + "_Driver_fail";


    public static final String Repair_current_success = SysTemMessgelPresenter.class.getName()
            + "_Repair_current_success";
    public static final String Repair_current_fail = SysTemMessgelPresenter.class.getName()
            + "_Repair_current_fail";

    public static final String Delete_success = SysTemMessgelPresenter.class.getName()
            + "_Delete_success";
    public static final String Delete_fail = SysTemMessgelPresenter.class.getName()
            + "_Delete_fail";
    /**
     * 消息清空
     */
    public static final String deletemMessge_success = SysTemMessgelPresenter.class.getName()
            + "_deletemMessge_success";
    public static final String deletemMessge_fail = SysTemMessgelPresenter.class.getName()
            + "_deletemMessge_fail";


    public static final String deletemMessge_one_success = SysTemMessgelPresenter.class.getName()
            + "_deletemMessge_one_success";
    public static final String deletemMessge_one_fail = SysTemMessgelPresenter.class.getName()
            + "_deletemMessge_one_fail";
    /**
     * 订单
     */
    public static final String dingdan_success = SysTemMessgelPresenter.class.getName()
            + "_dingdan_success";
    public static final String dingdan_fail = SysTemMessgelPresenter.class.getName()
            + "_dingdan_fail";


    /**
     * 支持账号提现账号列表
     */
    public static final String ZhangHaoList_success = SysTemMessgelPresenter.class.getName()+ "_ZhangHaoList_success";
    public static final String ZhangHaoList_fail = SysTemMessgelPresenter.class.getName()+ "_ZhangHaoList_fail";

    /**
     * 支持账号提现类型
     */
    public static final String BangdingType_success = SysTemMessgelPresenter.class.getName()+ "_BangdingType_success";
    public static final String BangdingType_fail = SysTemMessgelPresenter.class.getName()+ "_BangdingType_fail";
    public static final String BANG_success = SysTemMessgelPresenter.class.getName()+ "_BANG_success";
    public static final String BANG_fail = SysTemMessgelPresenter.class.getName()+ "_BANG_fail";



    public static final String WanCheng_success = SysTemMessgelPresenter.class.getName()+ "_WanCheng_success";
    public static final String WanCheng_fail = SysTemMessgelPresenter.class.getName()+ "_WanCheng_fail";

    public SysTemMessgelPresenter(Observer observer) {
        super(observer);
    }


    @Override
    public void onSysTemMessge(String uid, String msgtype, String pageindex, String pagesize) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(SystemMessge_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(SystemMessge_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.onSysTemMessge(uid, msgtype,pageindex,pagesize);
    }

    @Override
    public void onByRepairCurrent(String uid, String group_id) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Repair_current_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Repair_current_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.onByRepairCurrent(uid, group_id);
    }

    @Override
    public void onDelete(String uid, String id) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Delete_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Delete_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.onDelete(uid, id);
    }

    @Override
    public void onZhangHaoList(String uid) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(ZhangHaoList_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(ZhangHaoList_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.onZhangHaoList(uid);
    }

    @Override
    public void onBangDinType() {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(BangdingType_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(BangdingType_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.onBangDinType();
    }

    @Override
    public void onByWalletBind(String uid, String account, String account_type,String open_bank) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(BANG_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(BANG_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.onByWalletBind(uid, account,account_type,open_bank);
    }

    @Override
    public void onZhangDan(String uid, String current_page, String per_page) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(dingdan_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(dingdan_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.onZhangDan(uid, current_page,per_page);
    }

    @Override
    public void onWieXiuWanchng(String uid, String id, String group_id) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(WanCheng_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(WanCheng_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.onWieXiuWanchng(uid, id,group_id);
    }

    @Override
    public void deleteMess(String uid, String msg_type,String msg_id) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(deletemMessge_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(deletemMessge_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.deleteMess(uid, msg_type,msg_id);
    }
    @Override
    public void deleteMessOne(String uid, String msg_type,String msg_id) {
        ISystemMeesgeface<SystemMessgeBean> user = new SysTemMessgeprinsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(deletemMessge_one_success);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(deletemMessge_one_fail);
                        SysTemMessgelPresenter.this.setChanged();
                        SysTemMessgelPresenter.this.notifyObservers(result);

                    }
                });
        user.deleteMessOne(uid, msg_type,msg_id);
    }
}
